package com.xnx3.wangmarket.plugin.translate.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * 国际化插件
 * @author 管雷鸣
 */
@Entity(name="plugin_translate")
@Table(name = "plugin_translate")
public class Translate implements java.io.Serializable {

	/**
	 * 是否启用 - 启用
	 */
	public static final Short ENABLE_QIYONG = 1;
	/**
	 * 是否启用 - 禁用
	 */
	public static final Short ENABLE_JINYONG = 0;

	private Integer id;	//网站id，对应site.id 
	private Short enable;	//是否启用，是否在当前网站开启翻译能力。  <ul><li>1 : 启用</li><li>0 : 禁用</li></ul>
	private String javascript;	//js脚本内容。也就是 translate.execute() 之前自定义的东西 
	private String css;			//css样式内容。
	
	public Translate() {
		this.enable = ENABLE_JINYONG;
		this.javascript = "translate.listener.start();\n"
				+ "translate.setAutoDiscriminateLocalLanguage();";
		this.css = "#translate>.translateSelectLanguage {\n"
				+ "    position: absolute;\n"
				+ "    right: 2rem;\n"
				+ "    top: 2rem;\n"
				+ "    font-size: 1rem;\n"
				+ "    padding: 0.3rem;\n"
				+ "    padding-left: 0.5rem;\n"
				+ "    padding-right: 0.5rem;\n"
				+ "    border: 1px solid #C9C9C9;\n"
				+ "    background-color: #fff;\n"
				+ "    color: #555;\n"
				+ "}";
	}
	
	@Id
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}
	
	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "enable", columnDefinition="tinyint(2) COLLATE utf8mb4_unicode_ci COMMENT '是否启用，是否在当前网站开启翻译能力。 1启用，0禁用' default '0'")
	public Short getEnable() {
		return enable;
	}

	public void setEnable(Short enable) {
		this.enable = enable;
	}
	
	@Column(name = "javascript", columnDefinition="text COLLATE utf8mb4_unicode_ci COMMENT 'js脚本内容。也就是 translate.execute() 之前自定义的东西'")
	public String getJavascript() {
		return javascript;
	}

	public void setJavascript(String javascript) {
		this.javascript = javascript;
	}
	
	@Column(name = "css", columnDefinition="text COLLATE utf8mb4_unicode_ci COMMENT 'css'")
	public String getCss() {
		return css;
	}

	public void setCss(String css) {
		this.css = css;
	}

	@Override
	public String toString() {
		return "Translate [id=" + id + ", enable=" + enable + ", javascript=" + javascript + "]";
	}

}